package WrittenTest;

import java.util.Stack;

public class test12 {
    // 大数相加
    public static void main(String[] args) {
        String s = "1111", t = "222";
        StringBuilder ret = new StringBuilder();
        int i = s.length() - 1, j = t.length() - 1;
        int tmp = 0;
        while (i >= 0 || j >= 0 || tmp != 0) {
            if (i >= 0) {
                tmp += s.charAt(i--) - '0';
            }
            if (j >= 0) {
                tmp += t.charAt(j--) - '0';
            }
            ret.append(tmp % 10);
            tmp /= 10;
        }
        System.out.println(ret.reverse().toString());
    }
}
